Socket
Socket
Sign inDemoInstall

@yarnpkg/lockfile

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yarnpkg/lockfile

The parser/stringifier for Yarn lockfiles.


Version published
Maintainers
5
Created

What is @yarnpkg/lockfile?

The @yarnpkg/lockfile npm package is designed for parsing and generating `yarn.lock` files. It allows developers to programmatically interact with the contents of these lock files, which are used by Yarn to lock down the versions of package dependencies for a project. This ensures consistent installations across different machines and environments.

What are @yarnpkg/lockfile's main functionalities?

Parse a yarn.lock file

This feature allows you to parse the contents of a `yarn.lock` file into a JSON object. This can be useful for analyzing or manipulating the dependencies of a project programmatically.

"const fs = require('fs');\nconst lockfile = require('@yarnpkg/lockfile');\n\nlet file = fs.readFileSync('yarn.lock', 'utf8');\nlet json = lockfile.parse(file);\nconsole.log(json);"

Generate a yarn.lock file content

This feature enables you to generate the content for a `yarn.lock` file from a JSON object. This could be useful for creating or updating a lock file programmatically after modifying project dependencies.

"const fs = require('fs');\nconst lockfile = require('@yarnpkg/lockfile');\n\nlet json = {\n  type: 'success',\n  object: {\n    'package-name@version': {\n      version: '1.0.0',\n      resolved: 'https://registry.yarnpkg.com/package-name/-/package-name-1.0.0.tgz',\n      integrity: 'sha512-...'\n    }\n  }\n};\n\nlet file = lockfile.stringify(json.object);\nfs.writeFileSync('yarn.lock', file);"

Other packages similar to @yarnpkg/lockfile

Keywords

FAQs

Package last updated on 10 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc